<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@page import="com.seeyon.v3x.common.constants.ApplicationCategoryEnum" %>
<%@page import="com.seeyon.v3x.common.constants.Constants" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%@ include file="edocHeader.jsp"%>
<fmt:message key="common.opinion.been.hidden.label" bundle="${v3xCommonI18N}" var="opinionHidden" />
<fmt:message key="common.attachment.label" bundle="${v3xCommonI18N}" var="attachmentLabel" />
<link href="<c:url value="/common/RTE/editor/css/fck_editorarea4Show.css${v3x:resSuffix()}"/>" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="<c:url value="/apps_res/form/css/SeeyonForm.css${v3x:resSuffix()}" />">
<script type="text/javascript" charset="UTF-8" src="<c:url value="/common/office/js/hw.js${v3x:resSuffix()}" />"></script>
<script type="text/javascript" charset="UTF-8" src="<c:url value="/apps_res/v3xmain/js/phrase.js${v3x:resSuffix()}" />"></script>
<c:set value="${v3x:currentUser().id == summary.startUserId}" var="currentUserIsSender"/>
<v3x:showHtmlSignetOcx />
<script>
<!--
var logoURL = "${logoURL}";
var phraseURL = '<html:link renderURL="/phrase.do?method=list" />';
var attachmentLabel = "${v3x:escapeJavascript(attachmentLabel)}";
var theToShowAttachments = parent.theToShowAttachments || null;
var opn = "${opn}";
var bodyType="${formModel.edocBody.contentType}";
var canTransformToPdf="${canConvert}";


function edocFormDisplay(){
	initIpadScroll('bodyId',400,400);
	if(onlySeeContent=="true")
	{
	    var divObj=document.getElementById("formAreaDiv");
	    divObj.style.display="none";
	    /*divObj=document.getElementById("edocContentDiv");
	    divObj.style.display="block";
	    divObj.style.width="100%";
	    divObj.style.height="100%";*/
	    divObj=document.getElementById("colOpinion");
	    divObj.style.display="none";
		return true;
	}
  	var xml = document.getElementById("xml");
	var xsl = document.getElementById("xslt");
  		initReadSeeyonForm(xml.value,xsl.value);
  		dispOpinions(opinions,sendOpinionStr);
  		hiddeBorder(opn);
  		initHandWrite();
  		substituteLogo(logoURL);
	
  		return false;
}

function edocFormDisplayForShangKa(){
	if(onlySeeContent=="true")
	{
	    var divObj=document.getElementById("formAreaDiv");
	    divObj.style.display="none";
	    /*divObj=document.getElementById("edocContentDiv");
	    divObj.style.display="block";
	    divObj.style.width="100%";
	    divObj.style.height="100%";*/
	    divObj=document.getElementById("colOpinion");
	    divObj.style.display="none";
		return true;
	}
  	var xml = document.getElementById("xml");
	var xsl = document.getElementById("xslt");
  		initSeeyonForm(xml.value,xsl.value);
  		dispOpinions(opinions,sendOpinionStr);
  		hiddeBorder(opn);
  		setObjEvent();
  		initHandWrite();
  		substituteLogo(logoURL);
	
  		return false;
}
    	
formOperation = "aa";
${opinionsJs}

var officecanPrint="${officecanPrint}";
var officecanSaveLocal="${officecanSaveLocal}";

parent.officecanPrint = officecanPrint;
parent.officecanSaveLocal = officecanSaveLocal;

var onlySeeContent="${onlySeeContent}";
//设置打开的印章变灰
parent.setSignatureBlack = "${isDeptPigeonhole}";  

var isBoundSerialNo = "${isBoundSerialNo}";

var openFrom="${openFrom}";
var docId="${docId}";
var docSubject="${v3x:escapeJavascript(formModel.edocSummary.subject)}";
var summaryId="${formModel.edocSummary.id}";
var isAllowContainsChildDept_ExchangeUnit = true;
function dorepform()
{
    var subbutton=document.getElementById("subbtton");
    subbutton.disabled=true;
    return true;
}


//修改人：杨帆 2011-12-10———显示意见处理输入栏在相应意见位置 --start
function showOpinionsInputForm(){
	//alert(parent.theform.disPosition.value);
	var insertObj=parent.document.getElementById("disPosition").value;
	if(opinionSpans==null){initSpans();}
	  var inputObj=opinionSpans.get("my:"+insertObj,null);

	//删除附件和关联文档的onclick事件替换
	var str1=parent.document.getElementById("attachmentArea").innerHTML;
	var str2=parent.document.getElementById("attachment2Area").innerHTML;
	str1=str1.replace(/deleteAttachment/g,'deleteParentAtt');
	str2=str2.replace(/deleteAttachment/g,'deleteParentAtt');

	//处理态度
	var str3="";
	if(parent.canShowAttitude=="true" ){
		str3= parent.document.getElementById("processAttitude").innerHTML;
	}

	var processHTML="";
	if(parent.canShowCommonPhrase=="true"){
	  processHTML+='<div oncontextmenu="return false"';
	  processHTML+='style="position:absolute; right:350px; top:120px; width:260px; height:60px; z-index:2; background-color: #ffffff;display:none;overflow:no;border:1px solid #000000;"';
	  processHTML+='id="divPhrase" onmouseover="showPhrase()" onmouseout="hiddenPhrase()" oncontextmenu="return false">';
	  processHTML+='<IFRAME width="100%" id="phraseFrame" name="phraseFrame" height="100%" frameborder="0" align="middle" scrolling="no"';
	  processHTML+='marginheight="0" marginwidth="0"></IFRAME>';
	  processHTML+='</div>';
	}
	processHTML+="<table width='100%' border='0' cellspacing='0' cellpadding='0' class='edoc_deal_table'>";
	processHTML+="<tr><td height='30' class='edoc_deal' style='border-bottom:1px #bebdbd solid;'><div class='edoc_deal_div'>";

	if(parent.canShowAttitude=="true"){
		processHTML+="<div style='margin-top:-4px;display:inline-black;'>";
		processHTML+=str3;
		processHTML+="</div>";
	}
	if(parent.canShowCommonPhrase=="true"){
	   processHTML+="<a onclick='javascript:showPhrase(this)' style='float:left;font-size:12px;margin-top:4px;display:inline-block;'>";
	   processHTML+="<img src=\"/seeyon/apps_res/collaboration/images/commonPhrase.gif\" border=\"0\" align=\"absmiddle\" with=\"16\"/>";
	   processHTML+="常用语</a>";
	}
	if(parent.canUploadAttachment=="true"){
       processHTML+="<a href='javascript:parent.insertAttachment();reloadParentAtt();'  style='font-size:12px;margin-top:4px;display:inline-block;'>";
       processHTML+="<img src=\"/seeyon/common/images/attachment.gif\" border=\"0\" align=\"absmiddle\" with=\"16\"/>插入附件</a>";
	}
	if(parent.canUploadRel=="true"){
	   processHTML+="<a href='javascript:parent.quoteDocument();reloadParentAtt();' style='font-size:12px;margin-top:4px;display:inline-block;'>";
	   processHTML+="<img src=\"/seeyon/common/images/attachment.gif\" border=\"0\" align=\"absmiddle\" with=\"16\"/>关联文档</a>";
	}
	processHTML+="</div></td></tr>";

	if(parent.canShowOpinion=="true"){
	   processHTML+="<tr><td height='30' style='padding: 0px 10px;'>";
       processHTML+="<textarea id='contentOP' name='contentOP' rows='10' style='width: 100%;' maxSize='2000'></textarea>";
       processHTML+="</td></tr>";
	}
    if(parent.canUploadAttachment=="true"){
       processHTML+="<tr><td><div id='processatt1'>"+str1+"</div><div id='processatt2'>"+str2+"</div></td></tr>";
    }
    processHTML+="</table>";

	  if(inputObj==null)
	  {		  
		  inputObj=opinionSpans.get("my:otherOpinion",null);
		  if(inputObj==null){
			  document.getElementById("processOtherOpinions").innerHTML=processHTML;
			  document.getElementById("processOtherOpinions").style.display='';
		  }else{
			  hiddeBorderAndHeight(insertObj);
			  
			  inputObj.insertAdjacentHTML("beforeBegin",processHTML);
			  //inputObj.insertAdjacentHTML("beforeBegin","<br>");
		  }
	  }else{
		  hiddeBorderAndHeight(insertObj);
		  
		  inputObj.insertAdjacentHTML("beforeBegin",processHTML);
		  //inputObj.insertAdjacentHTML("beforeBegin","<br>");
	  }


    if(parent.canShowOpinion=="true"){
      document.getElementById("contentOP").value=parent.document.getElementById("contentOP").value;
    }
}


//重新加载附件显示
function reloadParentAtt(){
	var str1=parent.document.getElementById("attachmentArea").innerHTML;
	var str2=parent.document.getElementById("attachment2Area").innerHTML;
	str1=str1.replace(/deleteAttachment/g,'deleteParentAtt');
	str2=str2.replace(/deleteAttachment/g,'deleteParentAtt');
	document.getElementById("processatt1").innerHTML=str1;
	document.getElementById("processatt2").innerHTML=str2;
	
}

//删除附件并重新加载插件显示
function deleteParentAtt(fileurl){
	parent.deleteAttachment(fileurl);
	reloadParentAtt();
}

//隐藏意见框中的文本框 
function hiddeBorderAndHeight(opn)
{		
	var ops = opn.split(",");
	var spanObj;
	if(opinionSpans==null){initSpans();}
	for(i=0;i<ops.length;i++)
	{
		spanObj=opinionSpans.get("my:"+ops[i]);
		if(spanObj!=null)
		{			
			spanObj.style.border="0px";	
			spanObj.style.height="0";	
		}
	}

	if(opinionSpans.get("my:otherOpinion") !=null){
			opinionSpans.get("my:otherOpinion").style.border="0px";
		}
}
//修改人：杨帆 2011-12-10———显示意见处理输入栏在相应意见位置 --end


function relationSendV(){
	var recEdocId = "${recEdocId}";
	var recType = "${param.recType}";
	var url = "edocController.do?method=relationNewEdoc&recEdocId=${param.recEdocId}&recType=${param.recType}&forwardType=${param.forwardType}&newDate="+new Date();
    var rv = v3x.openWindow({
  				url: url,
  				height : 600,
  				width  : 600 
  	 });
  	if (rv == "true") {
  	  getA8Top().reFlesh();
  }
}

function relationRecV(){//弹出收文菜单
  		var url = "${relationUrl}";
  		url = url + "&sendSummaryId=${formModel.edocSummary.id}";
  		if(url == null || url == ""){
         alert("资源不存在！");
  	  		}else{
  		var rv = v3x.openWindow({
  	        url: url,
  	        workSpace: 'yes',
  	        dialogType: v3x.getBrowserFlag('pageBreak') == true ? 'modal' : '1'
  	    });
  	    if (rv == "true") {
  	        getA8Top().reFlesh();
  	    }
  	  		}
}

function loadRelationButton(){
  //关联发文
  var relSends = "${param.relSends}";
  if(relSends == "haveMany"){
	 document.getElementById("relationSend").style.display="block";
  }
  // 关联收文
  var relRecs = "${param.relRecs}";
  if(relRecs == "haveMany"){
	 document.getElementById("relationRec").style.display="block";
  }
}


//-->
</script>
${hwjs}
</head>
<body id="bodyId" onload="edocFormDisplay();loadRelationButton();" onunload="edocContentUnLoad();" <c:if test="${onlySeeContent=='true'}">scroll="no"</c:if>>

<%--puyc --%>
<div id="relationSend" align="right" style="display:none;"> <a href="#" onclick="relationSendV()" ><font color=red>关联发文</font></a></div>
<div id="relationRec" align="right" style="display:none;"> <a href="#" onclick="relationRecV()" ><font color=red>关联收文</font></a></div>
<%--//puyc --%>
<form name="sendForm" id="sendForm" method="post" action="">
<%@include file="unitId.jsp" %>
<input type="hidden" name="appName"   id="appName" value="<%=ApplicationCategoryEnum.edoc.getKey()%>">
<input type="hidden" name="summaryId" id="summaryId" value="${formModel.edocSummary.id}">
<input type="hidden" name="edoctable" id="edoctable" value="${formModel.edocSummary.formId}">
<input type="hidden" name="edocType"  id="edocType"  value="${formModel.edocSummary.edocType}">
<input type="hidden" name="currContentNum" id="currContentNum" value="0">
<input type="hidden" name="affairId"  id="affairId" value="${affairId}">
<input type="hidden" name="isUniteSend" id="isUniteSend" value="${formModel.edocSummary.isunit}">
<input type="hidden" name="orgAccountId" id="orgAccountId" value="${formModel.edocSummary.orgAccountId}">
<%--记录日志的时候不能区别出是修改了文单还是仅仅修改了文号。加此变量就是为了区别这个 BUG30034--%>
<input type="hidden" name="isOnlyModifyWordNo" id="isOnlyModifyWordNo" value=true>
<input type="hidden" id="pushMessageMemberIds" name="pushMessageMemberIds" value="">
<input type="hidden" name="templeteId" id="templeteId" value="${formModel.edocSummary.templeteId}">
<table width="100%" border="0" height="100%" cellspacing="0" cellpadding="0" style="">
  <tr>
  <c:if test="${onlySeeContent=='false'}">
    <td id="slideTd1" class="body-left"><img src="javascript:void(0)" height="1" width="20px"></td>
  </c:if>
    <td>
    <div id="formAreaDiv">
			
			<div style="display:none">
			<textarea id="xml" cols="40" rows="10">
				 ${formModel.xml}
         	</textarea>
         	</div>
         	<div style="display:none">
		   	<textarea id="xslt" cols="40" rows="10">   
				${formModel.xslt}
			</textarea>
		    </div>		 	
		 	<div id="html" name="html" style="height: auto;"></div>
		 	
		 	<div id="img" name="img" style="height:0px;"></div>	 
			<div style="display:none">
			<textarea name="submitstr" id="submitstr" cols="80" rows="20"></textarea>
			</div>
		 	
			</div>
	<%--
	<div name="edocContentDiv" id="edocContentDiv" width="0px" height="0px" style="display:none">
		<input type="hidden" name="bodyContentId" value="${formModel.edocBody.id}">
		<v3x:showContent  htmlId="edoc-contentText" content="${formModel.edocBody.content}" type="${formModel.edocBody.contentType}" createDate="${formModel.edocBody.createTime}" contentName="${formModel.edocBody.contentName}" viewMode ="edit"/>
		<script>editType="4,0"</script>
	</div>
	 --%>		
	
	</td>
	<c:if test="${onlySeeContent=='false'}">
    <td id="slideTd2" class="body-right"><img src="javascript:void(0)" height="1" width="20px"></td>
    </c:if>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td class="body-buttom-left"><img src="javascript:void(0)" height="1"></td>
    <td class="body-buttom-line"><img src="javascript:void(0)" height="1"></td>
    <td class="body-buttom-right"><img src="javascript:void(0)" height="1"></td>
  </tr>
</table>
</form>

<!-- 发起人附言 -->
<div id="colOpinion">
<c:if test="${senderOpinion ne null || fn:length(senderOpinion) > 0 || isSender}">
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0"  id="printSenderOpinionsTable">
  <tr>
    <td class="body-detail-border" id="senderOpinion">
    <hr style="width:100%;color:#a4A4A4;border:1px" size="1">
    	<div>
			<div class="body-detail-su" id="sendOpinionTitle"><fmt:message key="common.sender.label" bundle="${v3xCommonI18N}" /><fmt:message key="sender.note.label" /></div>
			<c:if test="${summary.finished == false && currentUserIsSender && (param.from eq 'Sent' || param.from eq 'Done' || param.from=='sended'||param.from=='Pending')}">
				<div id="addSenderOpinionDiv" style="visibility:inherit" class="div-float-right senderOpinionReply">
					<div>
						<a href="javascript:addReplySenderOpinion()" class="font-12px"><fmt:message key="sender.addnote.label"/></a>
					</div>
				</div>
			</c:if>
		</div>
		<div id="displaySenderOpinoinDiv" name="displaySenderOpinoinDiv">
			<c:forEach items="${senderOpinion}" var="opinion">
			<div style="width: 100%">
				<div class="optionContent1 wordbreak">
				<fmt:formatDate value="${opinion.createTime}" pattern="yyyy-MM-dd HH:mm"/>
				&nbsp;&nbsp;
				${v3x:toHTML(opinion.content)}
				<c:if test="${!empty opinion.proxyName}">
					<div class="opinion-agent">
						<fmt:message key="col.opinion.proxy">
							<fmt:param value="${opinion.proxyName}" />
						</fmt:message>
					</div>
				</c:if>
				</div>
				<%-- 附件 --%>
				
				<div class="div-float attsContent" style="display: block" id="attsDiv${opinion.id}">
					<div class="atts-label">${attachmentLabel} :&nbsp;&nbsp;</div>
					${senderOpinionAttStr[opinion.id]}
				</div>
			</div>
			</c:forEach>
		</div>
		<%-- 用于存放本次发起人附言的内容 --%>
		<div id="replyDivsenderOpinionDIV"></div>
		<c:if test="${summary.finished == false && currentUserIsSender && (param.from eq 'Sent' || param.from eq 'Done' || param.from=='sended'||param.from=='Pending')}">
		<%-- 发起人附言框位置 --%>
		<div class="comment-div div-float" style="display:none" id="replyDivsenderOpinion">
		<form name="repform" method="post" target="replyCommentIframe" action="<html:link renderURL='/edocController.do?method=doComment' />" onsubmit="return (checkReplyForm(this) &&dorepform()&& saveAttachment())" style="margin: 0px;">
		<input type="hidden" name="summaryId" value="${formModel.edocSummary.id}">
		<input type="hidden" name="opinionId" value="">
		<input type="hidden" name="startMemberId" value="${senderId}">
		<input type="hidden" name="memberId" value="">
		<input type="hidden" name="memberName" value="">
		<input type="hidden" name="isProxy" value="${isProxy}">
		<input type="hidden" name="affairId" value="${affairId}">
		
		<input type="hidden" name="isNoteAddOrReply" value="reply">
		<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td colspan="2">
					<textarea name="postscriptContent" cols="" rows="" style="width: 100%;height: 80px" class="font-12px" inputName="<fmt:message key='topic.reply.content.label' />" validate="notNull" maxSize="500"></textarea>
				</td>
			</tr>
			<tr>
				<td align="right" colspan="2">
					<span class="like-a font-12px" id="uploadAttachmentSpan" onclick="insertAttachment()"><fmt:message key="common.toolbar.insertAttachment.label" bundle="${v3xCommonI18N}" /></span>
					<label for="isSendMessage" class="font-12px">
						<input name="isSendMessage" type="checkbox" value="1" checked="checked">
						<fmt:message key="col.isSendMessage.label"  bundle="${colI18N}"/>
					</label>
					<input type="submit" name="b12" id="subbtton" class="button-default-2" value="<fmt:message key='common.button.submit.label' bundle="${v3xCommonI18N}" />">
					<input type="button" name="b12" class="button-default-2" value="<fmt:message key='common.button.cancel.label' bundle="${v3xCommonI18N}" />" onclick="document.getElementById('postscriptContent').value='';document.getElementById('replyDivsenderOpinion').style.display='none';deleteAllAttachment(0);">
				</td>
			</tr>
			
			<tr id="attachmentTR" style="display:none;">
	      		<td nowrap="nowrap" width="10%" height="18" valign="top" class="font-12px">${attachmentLabel}: </td>
	      		<td valign="top"><div class="div-float font-12px">(<span id="attachmentNumberDiv"></span>个)</div>
					<v3x:fileUpload />
	      		</td>
			</tr>
			
		</table>
		</form>
		</div>
		</c:if>
	</td>
  </tr>
  </table>
</c:if>

<%--显示未绑定公文元素的节点的处理意见 --%>
<table align="center" width="95%" border="0" cellspacing="0" cellpadding="0" id="printOtherOpinionsTable">
	<tr>
		<td>
			<hr style="width:100%;color:#a4A4A4;border:1px" size="1">
			<div class="div-float">
				<div class="div-float body-detail-su"  id="dealOpinionTitle"><fmt:message key="edoc.element.comment"  /></div>
			</div>
			<div  class="optionContent wordbreak" id="processOtherOpinions" name="processOtherOpinions" style="display:none;"></div>
			<div  class="optionContent wordbreak" id="displayOtherOpinions" name="displayOtherOpinions" style="visibility:hidden;"></div>
		</td>
	</tr>
</table>

<iframe name="replyCommentIframe" frameborder="0" height="0" width="0" scrolling="no" marginheight="0" marginwidth="0"></iframe>
<!-- 发起人附言 结束-->
</div>
<c:if test="${!empty param.firstPDFId}">
	<div name="edocContentDiv" id="edocContentDiv" width="0px" height="0px" style="display:none">
		<v3x:showContent  htmlId="edoc-contentText" content="${param.firstPDFId}" type="${'Pdf'}" createDate="${summary.firstBody.createTime}" contentName="${summary.firstBody.contentName}" viewMode ="edit"/>
	</div>
</c:if>
</body>
</html>
